package com.geeguo.ebuilder.core.common.dictionary;

import java.util.Arrays;
import java.util.List;

public enum StateEnum implements IDictionary {

    /**
     * 有效
     */
    Valid(1, "启用"),
    /**
     * 无效
     */
    Invalid(2, "停用");

    private int    value;
    private String label;
    
    StateEnum(int value, String label) {
        this.value = value;
        this.label = label;
    }
    
    @Override
    public int getValue() {
        return value;
    }

    @Override
    public String getLabel() {
        return label;
    }

    public static List<StateEnum> getEnumValues() {
        return Arrays.asList(values());
    }
    
    public static StateEnum parse(int value) {
        for (StateEnum item : StateEnum.values()) {
            if (value == item.getValue()) {
                return item;
            }
        }
        return null;
    }
}